import request from '@/utils/request'

//获取分类列表数据
export function getCategoryTree(){
  return request({
    url: '/manager/goods/category/allChildren',
    method: 'get',
  })
}

//获取分类列表数据
export function categoryTreeList(){
  return request({
    url: '/manager/goods/category/tree',
    method: 'get',
  })
}

//获取分类列表数据
export function getCategoryAll(){
  return request({
    url: '/manager/goods/category/listAll',
    method: 'get',
  })
}

//  添加商品分类
export function addCategory(data){
  return request({
    url: '/manager/goods/category',
    method: 'post',
    data: data
  })
}

//  编辑商品分类
export function editCategory(data){
  return request({
    url: '/manager/goods/category',
    method: 'put',
    data: data
  })
}

// 删除商品分类
export function delCategory(ids) {
  return request({
    url: '/manager/goods/category/' + ids,
    method: 'delete'
  })
}

//  变更分类启用禁用状态
export function chgCategoryEnable(data){
  return request({
    url: '/manager/goods/category/chgEnable',
    method: 'post',
    data: data
  })
}

//  获取商品分类关联品牌列表
export function listCategoryBrands(categoryId){
  return request({
    url: '/manager/goods/category/brand/' + categoryId,
    method: 'get',
  })
}

//  保存商品分类品牌关联
export function saveCategoryBrand(data){
  return request({
    url: '/manager/goods/category/brand/bind',
    method: 'post',
    data: data
  })
}
//  获取商品分类关联规格列表
export function listCategorySpecs(categoryId){
  return request({
    url: '/manager/goods/category/spec/' + categoryId,
    method: 'get',
  })
}

//  保存商品分类规格关联
export function bindCategorySpec(data){
  return request({
    url: '/manager/goods/category/spec/bind',
    method: 'post',
    data: data
  })
}

